<?php

/**
 * 
 */
class Admin_GaleriaController extends App_Controller_Default
{
	/**
	 * 
	 * @var unknown_type
	 */
	protected $_mapper;
	
	/**
	 * (non-PHPdoc)
	 * @see Zend_Controller_Action::init()
	 */
	public function init()
	{
		$this->_mapper = new Model_Mapper_Imagem();
	}

	/**
	 * (non-PHPdoc)
	 * @see App_Controller_Default::indexAction()
	 */
	public function indexAction()
	{
		$mapper = new Model_Mapper_Regiao();
		
		$rowsRegiao = $mapper->fetchAll(); 
		
		$this->view->rowsRegiao = $rowsRegiao;
	}
	
	/**
	 * 
	 * @access public
	 * @return void
	 */
	public function localAction()
	{
		$reg_id = $this->_getParam( 'reg_id', 0 );
		
		$mapper = new Model_Mapper_Local();
		$mapper->setData( array('reg_id' => $reg_id) );
		
		$rows = $mapper->fetchTree();
		
		$this->_helper->json( $rows->toArray() );
	}
	
	/**
	 * 
	 * @access public
	 * @return void
	 */
	public function imagemAction()
	{
		$this->_helper->layout()->disableLayout();
		
		$lcl_id = $this->_getParam( 'lcl_id', 0 );
		
		$this->_mapper->setData( array('lcl_id' => $lcl_id) );
		
		$rows = $this->_mapper->fetchImage();
		
		$this->view->rows = $rows;
	}
}